<div id="description">This tests for a crash when pasting into a link that is display:block.  'bar' is pasted between 'foo' and 'baz', and must be part of the link in order to achieve the expected paragraph structure.  It should be part of the link but of the default font style. <b>'bar' shouldn't be underlined and the second style span is unnecessary, since its only property is overridden by its only child.</b></div>
<div id="edit" contenteditable="true"><a id="anchor" href="http://www.google.com/" style="display:block;">foobaz</a></div>

<script>
var sel = window.getSelection();
var anchor = document.getElementById("anchor");
var text = anchor.firstChild;
sel.collapse(text, 3);

document.execCommand("InsertHTML", false, "bar");
if (window.testRunner) {
    testRunner.dumpAsText();
    document.body.innerText = document.getElementById("description").innerText + "\n" + document.getElementById("edit").innerHTML;
}
</script>
